package org.orz.story.member.biz.account.web.frontend;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.orz.cloud.auth.ServiceContextUtil;
import org.orz.cloud.auth.domain.UserInfo;
import org.orz.cloud.common.result.ResultDTO;
import org.orz.story.member.biz.account.model.req.LoginReq;
import org.orz.story.member.biz.account.service.MemAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("account")
@Api(tags = "用户端账户接口")
public class AccountController {
    @Autowired
    private MemAccountService memAccountService;

    @PostMapping("login")
    @ApiOperation("用户端登录")
    public ResultDTO<UserInfo> login(@RequestBody LoginReq req){
        return ResultDTO.success(memAccountService.login(req, ServiceContextUtil.getWorkbenchWithExistCheck()));
    }
}
